package m.jclecai.com.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;

import m.jclecai.com.bean.Content;
import m.jclecai.com.inter.IAdapterChange;


/**
 * Created by hp on 2017/4/24.
 */

public class BettingRXJAdapter extends BaseAdapter {

    private ArrayList<Content> mDatas = null;
    private IAdapterChange mChange = null;

    public BettingRXJAdapter(IAdapterChange mChange) {
        super();
        this.mChange = mChange;
        this.mDatas = new ArrayList<>();
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return mDatas.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return mDatas.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return mDatas.get(position).getItemId();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        return mChange.onItemChanged(position, convertView, parent);
    }

    public void addData(Content item) {
        // TODO Auto-generated method stub
        mDatas.add(item);
    }

    public void clearData() {
        mDatas.clear();
    }

    public ArrayList<Content> getList(){
        return mDatas;
    }
}
